<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Hard
  </div>
  <div>
   <h1 class="question_title">
    25. Reverse Nodes in k-Group
   </h1>
   <p>
    Given a linked list, reverse the nodes of a linked list
    <em>
     k
    </em>
    at a time and return its modified list.
   </p>
   <p>
    <em>
     k
    </em>
    is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of
    <em>
     k
    </em>
    then left-out nodes in the end should remain as it is.
   </p>
   <ul>
   </ul>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <p>
    Given this linked list:
    <code>
     1-&gt;2-&gt;3-&gt;4-&gt;5
    </code>
   </p>
   <p>
    For
    <em>
     k
    </em>
    = 2, you should return:
    <code>
     2-&gt;1-&gt;4-&gt;3-&gt;5
    </code>
   </p>
   <p>
    For
    <em>
     k
    </em>
    = 3, you should return:
    <code>
     3-&gt;2-&gt;1-&gt;4-&gt;5
    </code>
   </p>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ul>
    <li>
     Only constant extra memory is allowed.
    </li>
    <li>
     You may not alter the values in the list's nodes, only nodes itself may be changed.
    </li>
   </ul>
  </div>
  <div>
   <h1 class="question_title">
    25. k个一组翻转链表
   </h1>
   <p>
    给出一个链表，每&nbsp;
    <em>
     k&nbsp;
    </em>
    个节点一组进行翻转，并返回翻转后的链表。
   </p>
   <p>
    <em>
     k&nbsp;
    </em>
    是一个正整数，它的值小于或等于链表的长度。如果节点总数不是&nbsp;
    <em>
     k&nbsp;
    </em>
    的整数倍，那么将最后剩余节点保持原有顺序。
   </p>
   <p>
    <strong>
     示例 :
    </strong>
   </p>
   <p>
    给定这个链表：
    <code>
     1-&gt;2-&gt;3-&gt;4-&gt;5
    </code>
   </p>
   <p>
    当&nbsp;
    <em>
     k&nbsp;
    </em>
    = 2 时，应当返回:
    <code>
     2-&gt;1-&gt;4-&gt;3-&gt;5
    </code>
   </p>
   <p>
    当&nbsp;
    <em>
     k&nbsp;
    </em>
    = 3 时，应当返回:
    <code>
     3-&gt;2-&gt;1-&gt;4-&gt;5
    </code>
   </p>
   <p>
    <strong>
     说明 :
    </strong>
   </p>
   <ul>
    <li>
     你的算法只能使用常数的额外空间。
    </li>
    <li>
     <strong>
      你不能只是单纯的改变节点内部的值
     </strong>
     ，而是需要实际的进行节点交换。
    </li>
   </ul>
  </div>
 </body>
</html>